/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package config;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Configuration Manager
 * Singleton Pattern
 * @author pieterc
 */
public class CM {

    private static CM c = new CM();
    private Properties p;

    private CM() {
        p = new Properties();
        try {
            p.load(new FileInputStream("config.properties"));
        } catch (FileNotFoundException ex) {
            Logger.getLogger(CM.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(CM.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public static CM getInstance() {
        return c;
    }

    public String getValue(String key) {
        return p.getProperty(key);
    }

    public void setValue(String key, String value){
        p.setProperty(key, value);
    }
}
